home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / DiskUtil / Misc / BTNTape / doc / drives.doc next >
Text File  |  1994-04-03  |  7KB  |  149 lines

  1. This section of the BTN documentation gives some background information
  2. about how tape drives work.  If you already know you may want to skip it.
  3.  
  4. ****    BTNtape:  an AmigaDOS handler for SCSI tape drives
  5. ****       Version 3.0   3/14/94
  6. ****       Freeware by Bob Rethemeyer   (drBob@cup.portal.com)
  7. ****    (c) Copyright 1990, 1994  Robert Rethemeyer.
  8.  
  9.  
  10.    There are essentially two types of SCSI tape drives supported by BTNtape:
  11.    SEQUENTIAL and DIRECT-ACCESS.  The sequential type is the far more common,
  12.    but occasionally the direct-access drives can be gotten cheaply.
  13.  
  14.    Although some manufacturers of tape drives may support some additional
  15.    fancy commands, BTNtape does not make use of them.  It caters to the
  16.    lowest common denominator of tape drive, to ensure maximum compatibility
  17.    and reduce the complexity of the code.
  18.  
  19.    A note about terminology.  I will use the term "tapefile" to refer to
  20.    a file stored on a tape, to distinguish it from an AmigaDOS file.
  21.    A tapefile may be a TAR archive containing multiple AmigaDOS files;
  22.    in this sense it is sometimes called a "backup set".
  23.  
  24.  
  25. BLOCKS
  26.  
  27.    The speed of tape drives requires that data bytes be written in groups,
  28.    called blocks.  Tape drives may be capable of two modes of blocking
  29.    bytes:  variable block mode and fixed block mode.  Most drives have
  30.    only fixed mode, but some (especially newer) drives can do both.
  31.    BTN always operates drives in fixed block mode.
  32.  
  33.    Variable block mode means that each block may be a different, arbitrary
  34.    size than other blocks in the tapefile.  Not all tape drives are
  35.    capable of this mode, and in any case BTNtape does not support it.
  36.  
  37.    Fixed block mode means that every block in a tapefile is exactly
  38.    the same number of bytes.  Most fixed block drives have a block
  39.    size which cannot be changed, but other (again newer) drives will
  40.    allow you to specify the fixed block size, within a certain range.
  41.  
  42.    What does this mean to you?  A couple things.
  43.  
  44.    First, if a tape was written with a certain block size, you must read
  45.    it using the same block size.  If your drive can't do that block size,
  46.    you are out of luck for that tape.
  47.  
  48.    Second, the size of all tapefiles is rounded up to the nearest
  49.    block size boundary.  So if your drive block size is 512 bytes and you
  50.    want to write an 800 byte file, it is stored on the tape as 1024 bytes.
  51.    When you read it back you will get 1024 bytes with the last 244 bytes
  52.    padded with extraneous zeroes.  For this reason it is unwise to store
  53.    in tapefiles raw AmigaDOS executable files, which must be an exact size.
  54.    Instead use TAR to create an archive to contain the file(s).
  55.  
  56.    Most tape drives are more efficient if you write more than just one
  57.    block at a time, because usually a gap is created after each write
  58.    operation.  This gap is essentially wasted tape, so it is better to
  59.    keep the ratio of gaps to blocks small.  BTNtape is capable of collecting
  60.    multiple blocks of data before initiating a write.  For example, if
  61.    your block size is 512 bytes, you can specify (using the "NB" parameter)
  62.    that BTN write in groups of, say 256 blocks (131072 bytes).  This way
  63.    there will be a gap every 131072 bytes instead of every 512 bytes.
  64.  
  65.  
  66. SEQUENTIAL DRIVES
  67.  
  68.    As the name implies, data on a sequential tape drive can only be
  69.    read or written in consecutive blocks, the natural mode of accessing
  70.    an inherently sequential medium.  The tape head is positioned at
  71.    a single point on a long noodle of tape.  The natural direction of
  72.    movement of the tape is forward.  The drive cannot read or write
  73.    backwards, but it can rewind or fast-forward the tape to position
  74.    the head at a point in anticipation of reading or writing.
  75.  
  76.    The data on a tape can be viewed as follows:
  77.  
  78.     BOT/---TF0---/FM/---TF1---/FM/---TFn---/FM/--BLANK--/--INACCESSIBLE--/EOT
  79.  
  80.  
  81.    BOT is the beginning of the tape, the point you get to after a rewind.
  82.    This is sometimes called the load point.
  83.  
  84.    TF0, TF1, etc. are the tapefiles, as many and as large as you can
  85.    fit on the tape.
  86.  
  87.    FM is a filemark, a special marker placed to separate tapefiles.
  88.    BTN automatically writes a filemark when it finishes writing a tapefile.
  89.  
  90.    BLANK is the area following the last filemark on the tape.  Most
  91.    tape drives seem to erase the tape just ahead of where it is currently
  92.    writing, so the drive can later easily find the next available write area.
  93.  
  94.    The area beyond the blank spot cannot be read by most tape drives,
  95.    but of course it can be written over as you write more data to the tape.
  96.  
  97.    When the tape becomes full or you have read to the end of a full tape,
  98.    the EOT (end of tape) marker is hit.  This will result in a special
  99.    status being returned to the system so that it may take special action.
  100.    [BTN does not currently deal with EOT very well, try to avoid it.]
  101.  
  102.    Most tape drives enforce special restrictions on how you can access
  103.    the data on a tape.  Please note that these restrictions are imposed
  104.    by the drive, and that BTN must honor them.
  105.  
  106.    WRITES:  you may write data at the beginning of the tape, or at the
  107.    end of the last-written data starting at the blank spot.  You may
  108.    not write in the middle of the tape and expect the subsequent data
  109.    to be preserved.  For example, if you have 5 existing tapefiles and you
  110.    want to rewrite the 3rd, the 4th and 5th files are effectively destroyed.
  111.    Thus BTN supports only writing to the beginning of the tape (which makes
  112.    all previous files on the tape inaccessible), or appending a new file
  113.    to the end of the existing files (just after the last filemark).
  114.    If you append a file when not already at the blank spot, the tape
  115.    is rewound then fast-forward is used to get to the blank spot.
  116.  
  117.    READS:  you may read only existing files on the tape before the blank spot.
  118.    You cannot read past the blank spot to get old files that used to be there.
  119.    If you ask to read a file in the middle of the tape, the drive will
  120.    fast-forward to that file before starting to read.  If you are already
  121.    in the middle of the tape positioned ready to read the next tapefile
  122.    in the sequence, no additional tape movement is necessary, and reading
  123.    begins immediately.  But if you want to read a file out of sequence,
  124.    it must rewind to the beginning and fast-forward again.
  125.  
  126.  
  127. DIRECT-ACCESS DRIVES
  128.  
  129.    From a programming point of view, a direct-access (DA) drive looks more
  130.    like a disk drive than a sequential device.  But physically, it is
  131.    still a sequential tape drive.  The onboard controller of the DA drive
  132.    handles all tape movement to make any point on the tape accessible
  133.    in any order, albeit with a substantial delay.
  134.  
  135.    The tapes used with DA drives must be formatted into fixed-sized
  136.    numbered blocks, like a disk drive.  You can then read or write
  137.    a block address anywhere on the tape, and the drive will proceed
  138.    to spin its little brains out to position the tape to that block.
  139.  
  140.    BTNtape does not make use of the random access aspect of DA drives.
  141.    It writes tapefiles by starting at a block number and incrementing
  142.    the block number for subsequent blocks.
  143.  
  144.    DA drives do not have filemarks, so if there is more than one tapefile,
  145.    they must be kept separate by you keeping track of their starting
  146.    block numbers to avoid overlapping them.
  147.  
  148.  
  149.